package interfaceCustomer;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
		//in this screen the customer chooses subscription type
public class MakeSubscriptionPanel2 extends JPanel implements ActionListener{
	private JButton btnBackToMenu;
	private JButton btnChangeCar;
	private JButton btnNext;
	private JLabel lblCusId;
	private JLabel lblCusName;
	private JLabel lblSelectedCars;
	private JTextField txtCusId;
	private JTextField txtCusName;
	private ButtonGroup buttonGroup;
	private JRadioButton monthly,full;
	private CustomerFrame backtomenu;   
	
	public MakeSubscriptionPanel2(CustomerFrame _cf)
	{
			backtomenu = _cf;

			this.setLayout(null);
		//	this.getContentPane().setBackground(new Color(0,0,0));
							
		    monthly = new JRadioButton("Monthly");
		    full = new JRadioButton("Full");
		    buttonGroup = new ButtonGroup();
		    buttonGroup.add(monthly);
		    buttonGroup.add(full); 
		    monthly.setBounds(131, 124, 100, 25);
		    full.setBounds(131, 152, 100, 25);
		    this.add(monthly);
			this.add(full);
			monthly.addActionListener(this);
			full.addActionListener(this);
			 
			btnBackToMenu = new JButton("Back To Menu");
			btnBackToMenu.setBounds(32, 215, 115, 25);
			this.add(btnBackToMenu);
			btnBackToMenu.addActionListener(this);
			
			btnNext = new JButton("Next");
			btnNext.setBounds(290, 215, 115, 25);
			this.add(btnNext);
			btnNext.addActionListener(this);
			
			btnChangeCar = new JButton("Change Car/s");
			btnChangeCar.setBounds(161, 215, 115, 25);
			this.add(btnChangeCar);
			btnChangeCar.addActionListener(this);
			
			lblCusId = new JLabel("Customer ID:");
			lblCusId.setBounds(10, 10, 75, 25);
			this.add(lblCusId);
			
			lblSelectedCars = new JLabel("Selected Cars:");
			lblSelectedCars.setBounds(10, 60, 85, 25);
			this.add(lblSelectedCars);
			
			txtCusId = new JTextField();
			txtCusId.setBounds(90, 12, 120, 20);
			this.add(txtCusId);
			txtCusId.setEditable(false);
			
			lblCusName = new JLabel("Customer Name:");
			lblCusName.setBounds(215, 10, 97, 25);
			this.add(lblCusName);
			
			txtCusName = new JTextField();
			txtCusName.setBounds(317, 12, 120, 20);
			this.add(txtCusName);
			txtCusName.setEditable(false);
			
			this.setVisible(true);
		} 
		

	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() == btnBackToMenu) {
			backtomenu.ChangePanel(0);
		}
		if(e.getSource() == btnChangeCar) {
			backtomenu.ChangePanel(0.3);			
		} 
		if(full.isSelected() && e.getSource() == btnNext) {
			backtomenu.ChangePanel(3.11);
			
		}
		if(monthly.isSelected() && e.getSource() == btnNext) {
			backtomenu.ChangePanel(3.12);
		}
		
	}


}
